const fs = window.require("fs");
const promises = window.require("fs").promises;

const cfs = {
  readFile: (path) => {
    return promises.readFile(path, { encoding: "utf8" });
  },
  writeFile: (path, content) => {
    return promises.writeFile(path, content, { encoding: "utf8" });
  },
  rename: (oldPath, newPath) => {
    return promises.rename(oldPath, newPath);
  },
  deleteFile: (path) => {
    return promises.unlink(path);
  },
  checkName: (path) => {
    return fs.existsSync(path);
  },
};

export default cfs;
